package org.cnam.mobileShopping.bean;

import org.cnam.mobileShopping.wsclient.WSEntityListId;
import org.json.JSONException;
import org.json.JSONObject;

@WSEntityListId("user")
public class User {
	private Integer userid;

	private String login;

	private String pseudo;

	private String commonid;

	public User() {
		super();
	}

	public User(Integer userid, String login, String pseudo, String commonid) {
		super();
		this.userid = userid;
		this.login = login;
		this.pseudo = pseudo;
		this.commonid = commonid;
	}

	public Integer getUserid() {
		return userid;
	}

	public void setUserid(Integer userid) {
		this.userid = userid;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPseudo() {
		return pseudo;
	}

	public void setPseudo(String pseudo) {
		this.pseudo = pseudo;
	}

	public static User parseJSON(JSONObject jsonObject) throws JSONException {
		return new User(jsonObject.getInt("id"), jsonObject.getString("login"),
				jsonObject.getString("pseudo"),
				jsonObject.getString("commonid"));
	}

	public String getCommonid() {
		return commonid;
	}

	public void setCommonid(String commonid) {
		this.commonid = commonid;
	}

	@Override
	public String toString() {
		return  pseudo ;
	}

}
